package com.wx.controller.api;

import com.wx.common.WrapMapper;
import com.wx.common.Wrapper;
import com.wx.entity.SysArticle;
import com.wx.service.SysArticleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * <p>Title:	  weixin-go-with-you <br/> </p>
 * <p>Description TODO <br/> </p>
 * <p>Company:    医百科技有限公司  <br/> </p>
 *
 * @Author <a href="yangwensheng@100doc.com.cn"/>杨文生</a>  <br/>
 * @Date 2021/4/5 21:26
 */
@RestController
@RequestMapping(value = "/api/article", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@Api(tags = "文章管理(API)", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public class ApiArticleController {

    @Resource
    private SysArticleService sysArticleService;

    @GetMapping(value = "/{type}")
    @ApiOperation(httpMethod = "GET", value = "查询文章信息")
    public Wrapper<SysArticle> listPage(@PathVariable("type") Integer type) {
        SysArticle sysArticle = sysArticleService.selectByType(type);
        return WrapMapper.wrap(Wrapper.SUCCESS_CODE, Wrapper.SUCCESS_MESSAGE, sysArticle);
    }
}
